package ru.st.selenium;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.FindBys;
import org.openqa.selenium.support.pagefactory.ByChained;

public class MailClientPage3 {
	WebDriver driver;
	
	public MailClientPage3(WebDriver driver) {		
		this.driver = driver; 
	}
	
	@FindBys({
		@FindBy(id="ctl00_ContentPlaceHolder2_RadGrid1_ctl00_Header"),
		@FindBy(xpath=".//a[.='From']")
	})
	public WebElement fromElement;
	
	@FindBy
	(xpath=".//*[@id='ctl00_ContentPlaceHolder1_RadTreeView1']//span[.='Inbox']")
	public WebElement inboxElement;
	
	public void clickInboxElement() {
		driver.findElement(By.xpath(".//*[@id='ctl00_ContentPlaceHolder1_RadTreeView1']"
				+ "//div[@class='rtMid rtSelected']//span[@class='rtIn']")).click();
	}
	
	/*
	public void clickAjaxElement() {
		driver.findElement(new ByChained(By.id("ctl00_ContentPlaceHolder1_RadTreeView1"), 
				By.cssSelector("li[class='rtLI']"), 
				By.xpath(".//span[.='AJAX']"))).click(); 
	}
	
	public void clickOpenElement() {
		driver.findElement(new ByChained(By.id("ctl00_ContentPlaceHolder1_RadTreeView1"), 
				By.cssSelector("li[class='rtLI']"), 
				By.xpath(".//span[.='OpenAccess ORM']"))).click();
	}
	
	public void clickWinformsElement() {
		driver.findElement(new ByChained(By.id("ctl00_ContentPlaceHolder1_RadTreeView1"), 
				By.cssSelector("li[class='rtLI']"), 
				By.xpath(".//span[.='WinForms']"))).click();
	}
	
	public void clickSilverrightElement() {
		driver.findElement(new ByChained(By.id("ctl00_ContentPlaceHolder1_RadTreeView1"), 
				By.cssSelector("li[class='rtLI']"), 
				By.xpath(".//span[.='Silverlight']"))).click();
	}
	
	public void clickAnnouncementsElement() {
		driver.findElement(new ByChained(By.id("ctl00_ContentPlaceHolder1_RadTreeView1"), 
				By.cssSelector("li[class='rtLI']"), 
				By.xpath(".//span[.='Announcements']"))).click();
	}	
	
	public void clickWPFElement() {
		driver.findElement(new ByChained(By.id("ctl00_ContentPlaceHolder1_RadTreeView1"), 
				By.cssSelector("li[class='rtLI']"), 
				By.xpath(".//span[.='WPF']"))).click();
	}	
	
	public void clickFromElement() {
		driver.findElement(By.xpath(".//*[@id='ctl00_ContentPlaceHolder2_RadGrid1_ctl00_Header']//a[.='From']")).click();
	}
	*/
}
